package com.xc.h05.controller.changlongfei;

import com.xc.h05.entity.Course;
import com.xc.h05.entity.CoursePriceCLF;
import com.xc.h05.service.changlongfei.OnlineCoursesService;
import com.xc.h05.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/onlineCourses")
//在线课程
public class OnlineCoursesController {
    @Autowired
    OnlineCoursesService onlineCoursesService;
//    综合排序
    @GetMapping ("/getCourseOrderBy")
    public R getCourseOrderBy(int pageNum, int pageSize){
        return R.ok(onlineCoursesService.getCourseOrderBy(pageNum,pageSize));
    }

//    人气（学习数量）
    @GetMapping("/getCourseOrderByStudy")
    public R getCourseOrderByStudy(int pageNum, int pageSize){
        return R.ok(onlineCoursesService.getCourseOrderByStudy(pageNum,pageSize));
    }
//    价格（升序）
    @GetMapping("/getCourseOrderByPrice")
    public R getCourseOrderByPrice(int pageNum, int pageSize){
        return R.ok(onlineCoursesService.getCourseOrderByPrice(pageNum,pageSize));
    }
//    价格（降序）
    @GetMapping("/getCourseOrderByPriceDesc")
    public R getCourseOrderByPriceDesc(int pageNum, int pageSize){
        return R.ok(onlineCoursesService.getCourseOrderByPriceDesc(pageNum,pageSize));
    }
//    价格区间动态查询
    @GetMapping("/getCourseByPrice")
    public R getCourseByPrice(int pageNum, int pageSize, CoursePriceCLF coursePriceCLF){
        return R.ok(onlineCoursesService.getCourseByPrice(pageNum,pageSize,coursePriceCLF));
    }
}
